package com.dykj.controller;

import com.HttpUtils;
import com.alibaba.fastjson.JSONObject;
import com.dykj.dao.BlankstockMapper;
import com.dykj.entity.Blankstock;
import com.dykj.entity.Supplierbasicinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LALA
 * Date: 2018-11-25
 * Time: 10:03
 */
@RequestMapping("blank")
@RestController
public class BlankStockController {

    @Autowired
    private BlankstockMapper blankstockMapper;

    @RequestMapping("/stocks")
    public List<Blankstock> blankstocks(){
        String json = HttpUtils.get("http://192.168.2.129:666/blankInventory",null);
        List<Blankstock> list = JSONObject.parseArray(json,Blankstock.class);
        for(Blankstock Blankstock:list){
            this.blankstockMapper.insertSelective(Blankstock);
        }
        System.out.println("scuessful");
        return list;
    }
}
